#coding=utf-8
"""
Author:王霄
Time:2025/3/3 20:02
website:https://duoceshi.net
"""

import sys
sys.path.append('..')
from utiles.handle_path import *
import time
import unittest
from library.HTMLTestRunnerNew import HTMLTestRunner
from library.mail import SendMail

now=time.strftime("%Y-%m-%d-%H-%M-%S")
filename=report_path+"\\"+str(now)+'_cms_ui_report.html'
def auto_run():
    discover=unittest.defaultTestLoader.discover(start_dir=testcase_path,
                                                 pattern="test_*.py")
    f=open(filename,'wb')
    runner=HTMLTestRunner(stream=f,
                          title="cms后台接口自动化测试报告",
                          description="用例执行情况如下",
                          tester="小王")
    runner.run(discover)
    f.close()
def sendMail():
    sm =SendMail(send_msg=filename,attachment=filename)
    sm.send_mail()

if __name__ == '__main__':
    # sendMail()
    auto_run()